<?php $this->load->view('header') ?>

  <!-- CONTENT -->
<div id="content">
<div class="column full">
		
		<div class="box">
		<div class="box-header">Group : <?php echo $groupDetail['groupName']?></div>
		<div class="box-content">

      <?php echo isAccess('myuser','group','view')  || isAccess('myuser','group','userview') ? anchor('myuser/group/view' , '<span class="icon_text preview"></span>List Group' , 'class="button white"') : ''; ?>
       <br /><br />

        <?php if (isset($errorMessage)) : ?>
            <div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
        <?php endif; ?>

            <?php echo form_open('myuser/group/userView/id/'.$groupDetail['groupId'].'/page/'.$uri_to_assoc['page'].'/time/' . time(),array('name'=>'groupDetailUser','id'=>'groupDetailUser','method'=>'post','class'=>'frModalLoad')); ?>
            	<?php echo form_hidden('kirim','groupDetailUser');?>
                <b>Tambah User</b> &nbsp; : &nbsp; 
					<?php echo  form_input(array('name'=>'user','id'=>'srcUser','value'=>'','class'=> 'form-field'));?>
            		<?php echo form_submit('submitUser','Tambah','class="button themed"');?>
            </form>
            <!-- New line -->
            
            <?php if ($dataView) : ?>
            <br /><br />
            <div class="box">
                <div class="box-header">List User</div>
                <div class="box-content box-table">
                
            	<?php echo $paging?>
                <table width="100%">
                    <thead class="table-header">
                        <tr>
                            <th>No</th>
                            <th>User</th>
                            <th>Nama</th>
                            <th>Status</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <?php $i = false ;?>
                    <tbody>
                    	<?php $no = $uri_to_assoc['page'] + 1?>
                        <?php foreach($dataView as $row) : ?>
                        <?php $i = $i ? false : true ;?>
                        <tr class="<?php echo $i ? 'odd' : 'even' ?>">
                            <td><?php echo $no?></td>
                            <td><?php echo $row['userLogin']?></td>
                            <td><?php echo $row['userName']?></td>
                            <td><?php echo ($row['userStatus'] == 1 ) ? $this->lang->line('global_active') : (($row['userStatus'] == 2 ) ? $this->lang->line('global_delete') : $this->lang->line('global_pending') ) ; ?></td>
                            <td><?php echo $row['userId'] != getUserId() ? anchor('myuser/group/userView/id/' . $groupDetail['groupId'] .'/action/delete/userId/' . $row['userId'] . '/time/' . time() ,'<span class="icon_text cancel"></span> Hapus</a>', array('onClick' => "return confirm('".$this->lang->line('global_confirm_delete')."')" , 'class' => "button white")) : ''?></td>
                        </tr>
                        <?php $no++?>
                        <?php endforeach;?>
                    </tbody>
                </table>
                <div id="paging">
	            	<?php echo $paging?>
	            </div>	
                </div>
            </div>
		    <?php endif;?>
            
            
            <p>&nbsp;</p> 
            <div class="clear"></div>
		</div>
		</div>
	
	</div>
	</div>
	</div>
	
<link type="text/css" href="<?php echo base_url() ?>js/libs/jqueryui/1.8.2/css/ui-lightness/jquery-ui-1.8.2.custom.css" rel="stylesheet" />
<script src="<?php echo base_url();?>js/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="<?php echo base_url();?>js/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
<script type="text/javascript">
$.noConflict();
jQuery(document).ready(function($) {
	var srcUser = $("#srcUser");
	srcUser.autocomplete({ 
		source: function(request, response) {
		$.ajax({
			type: 'post',
			url: "<?php echo site_url()."/myuser/group/getJsonAutoComplete"?>",
			dataType: "json",
			data: "q="+srcUser.val()+"&al=userlogin",
			success: function(data) {
			
				response($.map( data, function( item ) {
					return {
						label: item.userlogin,
						value: item.userlogin
					}
				}))
			}
		})
		},
		minLength: 2,
		delay: 0 ,
		
	});	         		
});
</script>
<?php $this->load->view('footer') ?>